package com.example.demo03.file;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

/**
 * @Author: 枫糖
 * @Description:
 * @Date: Create in 14:52 2024/7/12
 */
@Configuration
public class SwaggerConfig {

    //创建swagger实例
    @Bean
    public Docket docket() {
        Docket docket=
                new Docket(DocumentationType.SWAGGER_2)
                        .apiInfo(getInfo())//设置接口文档的信息
                        .select()
                        .apis(RequestHandlerSelectors.basePackage("com.example.demo03.controller")) //指定为那些路径下得到类生成接口文档
                        .build()
                ;

        return docket;
    }

    private ApiInfo getInfo(){
        Contact DEFAULT_CONTACT = new Contact("枫糖", "https://gitee.com/Taylor-Adele/adele.git", "2060459476@qq.com");
        ApiInfo DEFAULT = new ApiInfo("用户管理系统API", "该系统中的接口专门操作用户的", "v1.0", "https://gitee.com/Taylor-Adele/adele.git",
                DEFAULT_CONTACT, "扣扣空间", "https://gitee.com/Taylor-Adele/adele.git", new ArrayList<VendorExtension>());
        return DEFAULT;
    }
}